{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "0afa04c3-e201-4b06-9ce8-612ec37684f6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "随机生成的二维整数数组arr1: \n",
      " [[3 1 5]\n",
      " [7 1 2]\n",
      " [8 8 3]]\n",
      "随机生成的一维整数数组arr2: \n",
      " [9 1 6]\n",
      "随机生成的二维小数数组arr3: \n",
      " [[1.43322001 2.14931214 4.90588079]\n",
      " [1.6439491  8.0589617  1.79587903]\n",
      " [4.00452355 0.50373884 8.21632188]]\n",
      "arr1和arr2相加：\n",
      " [[12  2 11]\n",
      " [16  2  8]\n",
      " [17  9  9]]\n",
      "arr1和arr2相乘: \n",
      " [[ 4.29966003  2.14931214 24.52940394]\n",
      " [11.5076437   8.0589617   3.59175805]\n",
      " [32.03618839  4.0299107  24.64896565]]\n",
      "以arr1为底数，arr2为指数的幂：\n",
      " [[    19683         1     15625]\n",
      " [ 40353607         1        64]\n",
      " [134217728         8       729]]\n",
      "arr1的倒数：\n",
      " [[0.33333333 1.         0.2       ]\n",
      " [0.14285714 1.         0.5       ]\n",
      " [0.125      0.125      0.33333333]]\n"
     ]
    },
    {
     "ename": "TypeError",
     "evalue": "around() got an unexpected keyword argument 'decimls'. Did you mean 'decimals'?",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[2], line 12\u001b[0m\n\u001b[0;32m     10\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m以arr1为底数，arr2为指数的幂：\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m'\u001b[39m,np\u001b[38;5;241m.\u001b[39mpower(arr1,arr2,dtype\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mint64\u001b[39m\u001b[38;5;124m'\u001b[39m))\n\u001b[0;32m     11\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124marr1的倒数：\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m'\u001b[39m,np\u001b[38;5;241m.\u001b[39mreciprocal(arr1,dtype \u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfloat\u001b[39m\u001b[38;5;124m'\u001b[39m))\n\u001b[1;32m---> 12\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m四舍五入，小数点后保留一位:\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m'\u001b[39m,np\u001b[38;5;241m.\u001b[39maround(arr3,decimls\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m1\u001b[39m))\n\u001b[0;32m     13\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124marr1的余弦值：\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m'\u001b[39m,np\u001b[38;5;241m.\u001b[39mcos(arr1 \u001b[38;5;241m*\u001b[39m np\u001b[38;5;241m.\u001b[39mpi \u001b[38;5;241m/\u001b[39m\u001b[38;5;241m180\u001b[39m))\n",
      "\u001b[1;31mTypeError\u001b[0m: around() got an unexpected keyword argument 'decimls'. Did you mean 'decimals'?"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "arr1 = np.random.randint(1,10,size=(3,3))\n",
    "print('随机生成的二维整数数组arr1: \\n', arr1)\n",
    "arr2 = np.random.randint(1,10,size=3)\n",
    "print('随机生成的一维整数数组arr2: \\n', arr2)\n",
    "arr3 = np.random.rand(3,3)*10\n",
    "print('随机生成的二维小数数组arr3: \\n', arr3)\n",
    "print('arr1和arr2相加：\\n',np.add(arr1,arr2))\n",
    "print('arr1和arr2相乘: \\n',np.multiply(arr1,arr3))\n",
    "print('以arr1为底数，arr2为指数的幂：\\n',np.power(arr1,arr2,dtype='int64'))\n",
    "print('arr1的倒数：\\n',np.reciprocal(arr1,dtype ='float'))\n",
    "print('四舍五入，小数点后保留一位:\\n',np.around(arr3,decimls=1))\n",
    "print('arr1的余弦值：\\n',np.cos(arr1 * np.pi /180))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b65f7da7-c883-4a77-b697-90d4dc5aa287",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
